package com.cljz.makepassenger.ui.holder;


import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.cljz.makepassenger.base.App;
import com.cljz.makepassenger.R;
import com.cljz.makepassenger.model.net.bean.MemberListBean;
import com.squareup.picasso.Picasso;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by apple on 2017/5/5.
 */

public class MemberListHolder extends RecyclerView.ViewHolder {
    @BindView(R.id.civ_head_pic)
    CircleImageView civHeadPic;
    @BindView(R.id.tv_nickname)
    TextView tvNickname;
    @BindView(R.id.tv_age)
    TextView tvAge;
    @BindView(R.id.iv_sex)
    ImageView ivSex;


    public MemberListHolder(View itemView) {
        super(itemView);
        ButterKnife.bind(this, itemView);

    }

    public void setData(List<MemberListBean.DataBean> memberList, int position) {
        MemberListBean.DataBean dataBean = memberList.get(position);
        Picasso.with(App.getInstance())
                .load(dataBean.getUser_logo())
                .error(R.mipmap.head_loading)
                .placeholder(R.mipmap.head_loading)
                .into(civHeadPic);
        tvNickname.setText(dataBean.getUser_nickname());
        tvAge.setText(dataBean.getAge());
        ivSex.setImageResource("1".equals(dataBean.getUser_sex()) ? R.mipmap.icon_boy : R.mipmap.icon_girl);
    }
}
